Advanced Lane Finding Project

The goals / steps of this project are the following:


First, I'll compute the camera calibration using chessboard images

this step we gather the object points and image points as 2 lists with multiple chessboard images.

Select one image and try to undistort it

compute the distortion matrix by using the objpoints and imgpoints, and undistort the image, example showing below:

as shown above, the image on the upper-right side is successfully undistored.

Select one road image and apply undistortion

Perspective Transformation

similar to the code in quizzes, we find 4 points closing to 4 edges of the chessboard image, and then map it to 4 points we assigned, to make the chessboard in a top-down angle.

to apply undistortion and perspective transformation on a stright line image, to make the 2 lanes looks vertically and in parallel.

To set the region perspective rectangle, and then apply the persective transformation

now we can see the straight line image is transformed to visualize 2 parallel lines.

Region of interest

to apply the region of interest mask to get rid of useless information

Gradients and Color Spaces

visualize colorspace channels

to compare the performance, we use a rather complicated example, test5.jpg

Try to tune the L-channel image in HLS space.

from the example above, we can see the white lane could be detected but yellow lane on the left side of the original image is lost.

Try to tune the S-channel image in HLS space.

It seems S-channel did a better job in detecting both lanes, but the shadow from the left blurred the left lane.

Try to tune the V-channel image in HSV space.

V-channel looks nice in handling both lanes.

Try to tune the Red channel image in RGB space.

As for red channel, the conclusion is similar that it detects the white lanes fairly well.

on the function above, we set the threshold similar to the experiment did in the lecture. However, it looks pretty bad because of the shadow, so we might choose not to use S-channel as the source image, or we could use another image and use & to get rid of the noise.

assemble multiple color-thresholding strategy with region of interest and then unwarp the image, to see how it looks now

Visualize color thresholding

the lanes details looks fairly clear.

Sobel Gradient

It's interesting that actually the lane details is not kept well after applying X-direction sobel gradient. Let's try Y-direction.

It seems the Y-direction sobel gradient doesn't always work very well on all images either.

Applying Sobel to the images on both horizontal and vertical direction

with the combination of both X and Y, the image looks slightly better.

Sobel Magnitude Threshold

Magnitude thresholding is OK to use since we can see it keeps the lane details. probably we can use it with the direction threshold to remove the horizontal details, so the lanes could be clearer.

Sobel Direction Threshold

verify the all images

Finding lanes

Sliding windows

Compute Curvature

Draw the line

Draw the curvature data on the image

Define a line class for storing data

Define complete image processing pipeline